import 'package:flutter/material.dart';

class MyApp12 extends StatelessWidget {
  const MyApp12({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: GridView(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 3, mainAxisSpacing: 10, crossAxisSpacing: 10),
        children: [
          Container(
            // 居中
            alignment: Alignment.center,
            color: Colors.red,
            width: 200,
            height: 300,
          ),
          Container(
            // 居中
            alignment: Alignment.center,
            color: Colors.red,
            width: 200,
            height: 300,
          ),
          Container(
            // 居中
            alignment: Alignment.center,
            color: Colors.red,
            width: 200,
            height: 300,
          ),
          Container(
            // 居中
            alignment: Alignment.center,
            color: Colors.red,
            width: 200,
            height: 300,
          )
        ],
      ),
    );
  }
}
